@layout("/common/_container.html"){
<div class="row">
    <div class="col-sm-12">
        <div class="ibox float-e-margins">

            <div class="ibox-content">
                <div class="row row-lg">
                    <div class="col-sm-12">
                        <#table id="LookupTable"/>
                    </div>
                </div>
            </div>
        </div>
        <div class="row btn-group-m-t">
            <div class="col-sm-10">
                <#button btnCss="info" name="提交" id="ensure" icon="fa-check" clickFun="LookupTable.ensure()"/>
                <#button btnCss="danger" name="取消" id="cancel" icon="fa-eraser" clickFun="LookupTable.cancel()"/>
            </div>
        </div>
    </div>


</div>
<script>
    var LookupTable = {
        id: "LookupTable",	//表格id
        seItem: null,		//选中的条目
        table: null,
        layerIndex: 1
    };

    LookupTable.initColumn = function(){
        return [
            {field: 'selectItem', radio: ${!muti},checkbox:${muti}},
            @for(fieldItem in fieldList){
            {title: '${fieldItem.fieldName}', field: '${fieldItem.field}', visible: true, align: 'center', valign: 'middle'},
        @}
    ]
    }

    LookupTable.check = function () {
        var selected = $('#' + this.id).bootstrapTable('getSelections');
        if(selected.length == 0){
            Feng.info("请先选中表格中的某一记录！");
            return false;
        }else{
            LookupTable.seItem = selected;
            return true;
        }
    };

    LookupTable.ensure=function(){

        if(this.check()){

            parent.$('#${id}Val').val(JSON.stringify(LookupTable.seItem));
            parent.layer.close(window.parent.lookUp.layerIndex);
        }

    }
    LookupTable.cancel=function(){
        parent.layer.close(window.parent.lookUp.layerIndex);
    }

    $(function(){
        var defaultColunms = LookupTable.initColumn();
        var table = new BSTable(LookupTable.id, "${dataUrl}", defaultColunms);
        table.setPaginationType("${paginationType}");
        table.method="get";
        table.height=300
        LookupTable.table = table.init();
    })


    //渲染分类js
</script>
@}